package com.cattsoft.ssm.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.cattsoft.ssm.component.UserComponent;
import com.cattsoft.ssm.entity.User;
import com.cattsoft.ssm.entity.UserVo;
@Service
@Transactional
public class UserServiceImpl implements UserService {
	
	private UserComponent userComponent;
	public UserComponent getUserComponent() {
		return userComponent;
	}
	public void setUserComponent(UserComponent userComponent) {
		this.userComponent = userComponent;
	}
	@Override
	public User login(UserVo userVo) {
		ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
		userComponent = (UserComponent)ctx.getBean("userComponent");
		return userComponent.login(userVo);
		
	}

}
